package com.studysb.studyspbt.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.studysb.studyspbt.entity.sysConfig;
import com.studysb.studyspbt.mapper.sysConfigMapper;
import com.studysb.studyspbt.service.sysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController()
@RequestMapping("/sysConfig")
public class sysConfigController {

    @Autowired
    private sysConfigService sysConfigService;

    @SaCheckLogin
    @GetMapping( "/list")
    public List<sysConfig> list(){
        return sysConfigService.list();
    }
    @GetMapping( "/listPage")
    public Page<sysConfig> listPage(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "3") Integer size){
        return sysConfigService.page(new Page<>(page,size));
    }


//    @PostMapping( "/login")
    @GetMapping( "/login")
    public String login(String username,String password){
//        return sysConfigService.list();
        System.out.println("username:"+username+"password:"+password);
        StpUtil.login(10001);
        return "登录成功";

    }
}
